//文件信息相关全变量
console.log(__dirname);
console.log(__filename);

//console对象
console.error("相关错误信息控制台输出")

//pocess进程
console.log(process.env.PATH)
console.log(process.pid)
console.log(process.argv)

//URL对象相关
const myURL= new URL("/foo","https://example.com");
myURL.searchParams.append("key","vaule");
console.log(myURL.href);

let params=new URLSearchParams(myURL.searchParams);
params.append("key1","value1");
params.append("key2","李四");
console.log(params);
myURL.search=params;
console.log(myURL.href);

//Buffer对象
const buf = Buffer.from("r中国","UTF-8");
const strBase64 =buf.toString("base64");
console.log(strBase64);
console.log(Buffer.from(strBase64,"base64").toString("UTF-8"));

//定时器
let time =setInterval(()=>{
    console.log(`${new Date().toLocaleString()}`);
},1000);

//Ctrl+C终止程序运行是事件处理 进程信号kill
process.on("SIGINT",()=>{
    console.log("系统退出...");
    clearInterval(timer);
});

// process.exit(0);
